package personal.zq.generator.sys.controller;


import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import personal.zq.generator.sys.client.req.UserInfoReq;
import personal.zq.generator.sys.client.resp.UserInfoResp;
import personal.zq.generator.sys.service.UserInfoService;

/**
 * 用户信息 前端控制器
 *
 * @author zhangqing
 * @since 2022-06-28 12:40:26
 */
@RestController
@RequestMapping("//userInfo")
public class UserInfoController {
    @Autowired
    UserInfoService service;

    @ApiOperation("新增")
    @PostMapping("/create")
    void create(@Validated @RequestBody UserInfoReq req) {
        service.create(req);
    }

    @ApiOperation("编辑")
    @PostMapping("/update")
    void update(@Validated @RequestBody UserInfoReq req) {
        service.update(req);
    }

    @ApiOperation("删除")
    @GetMapping("/del")
    void del(@PathVariable("id") Long id) {
        service.del(id);
    }


    @ApiOperation("分页查询")
    @GetMapping("/qry")
    IPage
            <UserInfoResp> qry(@Validated @RequestBody UserInfoReq req) {
        return service.qry(req);
    }

    @ApiOperation("查询详情")
    @GetMapping("/getDetail")
    UserInfoResp getDetail(@PathVariable("id") Long id) {
        return service.getDetail(id);
    }
}